package com.zhuangjie.rider.ws.put;

import com.zhuangjie.mvc.ws.annotation.MessagePut;
import com.zhuangjie.mvc.ws.annotation.Send;
import com.zhuangjie.mvc.ws.annotation.WSPut;
import com.zhuangjie.rider.helper.ServiceHelper;
import com.zhuangjie.rider.vo.SystemDispatchNearbyDeliveryOrder;

@WSPut(ws = "/rider")
public class RiderWSPut {

    @MessagePut("/delivery-order")
    public Object putDeliveryRider(SystemDispatchNearbyDeliveryOrder deliveryOrder, @Send String ...ids) {
        if (!ServiceHelper.isValidDesignatedDeliveryTime(deliveryOrder.getDesignatedDeliveryTime(),deliveryOrder.getDeliveryDuration())) {
            // 取消定时单标志
            deliveryOrder.setDesignatedDeliveryTime(null);
        }
        return deliveryOrder;
    }
}
